import 'package:base/widget/stick/stick_widget.dart';
import 'package:flutter/material.dart';

class StickPage extends StatefulWidget {
  @override
  _StickPageState createState() => _StickPageState();
}

class _StickPageState extends State<StickPage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: Text('stick page')),
      body: Container(
        child: ListView.builder(
          physics: AlwaysScrollableScrollPhysics(),
          itemCount: 100,
          itemBuilder: (BuildContext context, int index) {
            return Container(
              height: 200,
              color: Colors.deepOrange,
              child: StickWidget(
                ///header
                stickHeader: Container(
                  height: 50.0,
                  color: Colors.deepPurple,
                  padding: EdgeInsets.only(left: 10.0),
                  alignment: Alignment.centerLeft,
                  child: InkWell(
                    onTap: () {
                      print('header');
                    },
                    child: Text(
                      '我的 $index 头啊',
                      style: TextStyle(color: Colors.white),
                    ),
                  ),
                ),

                ///content
                stickContent: InkWell(
                  onTap: () {
                    print('content');
                  },
                  child: Container(
                    margin: EdgeInsets.only(left: 10),
                    color: Colors.pinkAccent,
                    height: 150,
                    child: Center(
                      child: Text(
                        '我的$index 内容 啊',
                        style: TextStyle(color: Colors.white),
                      ),
                    ),
                  ),
                ),
              ),
            );
          },
        ),
      ),
    );
  }
}
